import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/vant.js'
import store from './store.js'

import './assets/css/global.css'
Vue.config.productionTip = false

import axios from 'axios'
axios.defaults.baseURL = 'http://www.liulongbin.top:3005'
Vue.prototype.$http = axios 

Vue.filter('formatDate',function(time){
  var date = new Date(time)
  var y = date.getFullYear()
  var m = date.getMonth()+1
  var d = date.getDay()
  return y + '-' + m + '-' + d 
})

import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: 'qT14GyA4C0UFHLc6hiI3jQLFRLqK072A'
})

// import VeeValidate, { Validator } from "vee-validate";
// // 手机号码验证
// Validator.extend("mobile", {
//   getMessage: () => `请输入正确的手机号码`,
//   validate: 
// });
// Vue.use(VeeValidate);

// // Vue.prototype.$validator = Validator

import { ValidationProvider, extend } from "vee-validate";

// Add a rule.
extend("mobile", {
  validate: value =>
  value.length === 11 &&
  /^(((13[0-9]{1})|(14[57]{1})|(15[012356789]{1})|(17[03678]{1})|(18[0-9]{1})|(19[89]{1})|(16[6]{1}))+\d{8})$/.test(
    value
  ),
  message: "请输入正确的手机号码"
});

// Register it globally
Vue.component("ValidationProvider", ValidationProvider);


import VConsole from 'vconsole'

if (process.env.NODE_ENV === 'production') {
  new VConsole()
}

new Vue({
  store,
  router,
  render: h => h(App)
}).$mount('#app')
